//
//  XJConfigure.h
//  XinJiangMall
//
//  Created by Tzyang on 2018/4/2.
//  Copyright © 2018年 Tzyang. All rights reserved.
//

#ifndef XJConfigure_h
#define XJConfigure_h

#define KWidth [UIScreen mainScreen].bounds.size.width
#define KHeight [UIScreen mainScreen].bounds.size.height

#ifdef DEBUG

#define XJLog(FORMAT, ...) fprintf(stderr,"%s:%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);


#else

#define XJLog(...)

#endif

// 主色
#define MAIN_COLOR [UIColor colorWithRed:255.0/255.0 green:218.0/255.0 blue:68.0/255.0 alpha:1.0]

#define MAINS_COLOR [UIColor colorWithRed:255.0/255.0 green:218.0/255.0 blue:68.0/255.0 alpha:0.5]
// 白色
#define WHITE_COLOR [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0]
// 黑色
#define BLACK_COLOR [UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:1.0]
// 字体设置
#define XJFONTSET_M(s) [UIFont fontWithName:@"PingFangSC-Medium" size:s]
#define XJFONTSET_R(s) [UIFont fontWithName:@"PingFangSC-Regular" size:s]
#define XJFONTSET(f,s) [UIFont fontWithName:f size:s]
// 标题字体、大小
#define TITLE_FONT [UIFont fontWithName:@"PingFangSC-Medium" size:17]
// 标题颜色
#define TITLE_COLOR [UIColor colorWithRed:17.0/255.0 green:17.0/255.0 blue:17.0/255.0 alpha:1.0]
// tabBar底部字体、大小
#define TABBAR_ITEM_FONT [UIFont fontWithName:@"PingFangSC-Medium" size:10]
// tabBar底部字体颜色-selected
#define ITEM_SELECTED_COLOR [UIColor colorWithRed:255.0/255.0 green:218.0/255.0 blue:68.0/255.0 alpha:1.0]
// tabBar底部字体颜色-unselected
#define ITEM_UNSELECTED_COLOR [UIColor colorWithRed:170.0/255.0 green:170.0/255.0 blue:170.0/255.0 alpha:1.0]
// 搜索水印字体、大小
#define SEARCH_FONT [UIFont fontWithName:@"PingFangSC-Regular" size:13]

// 设置颜色RGB
#define XJCOLOR_RGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define XJCOLOR_RGBA(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a]

// 自适应设备宽度
#define ADAPTWidth(w) (KWidth / 375 * (w))
// 自适应设备高度
#define ADAPTHeight(h) (KHeight / 667 * (h))

#define WINDOW [UIApplication sharedApplication].keyWindow

#define PHONE_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
#define IOS8 ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0)
#define IOS7 ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0)
#define IOS10 ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0)

//判断设备型号
#define UI_IS_LANDSCAPE         ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft || [UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight)
#define UI_IS_IPAD              ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
#define UI_IS_IPHONE            ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
#define UI_IS_IPHONE4           (UI_IS_IPHONE && [[UIScreen mainScreen] bounds].size.height < 568.0)
#define UI_IS_IPHONE5           (UI_IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0)
#define UI_IS_IPHONE6           (UI_IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0)
#define UI_IS_IPHONE6PLUS       (UI_IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 736.0 || [[UIScreen mainScreen] bounds].size.width == 736.0) // Both orientations
#define UI_IS_IOS8_AND_HIGHER   ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0)

#define XJWeakSelf(type)  __weak typeof(type) weak##type = type;
#define XJStrongSelf(type)  __strong typeof(type) type = weak##type;



// 6-12 iphoneX
//#define kIs_iPhoneX (KWidth == 375.f && KHeight == 812.f)
#define kIs_iPhoneX (KHeight > 736.f)
#define kStatusBarAndNavigationBarHeight (kIs_iPhoneX ? 88.f : 64.f)
#define KStatusBarHeight (kIs_iPhoneX ? 44 : 20)

#endif /* XJConfigure_h */
